#!/usr/bin/python3
# coding=utf-8

class UnifyBookCapter:

    def __init__(self) -> None:
        super().__init__()
        self.id = None
        self.title = None
        self.content = None
        self.words = None
        self.gmtCreate = None
        self.gmtModified = None
        self.refUrl = None
        self.catalogId = None
        self.bookId = None

    def getBookId(self):
        return self.bookId

    def setBookId(self, bookId):
        self.bookId = bookId

    def getId(self):
        return self.id

    def setId(self, id):
        self.id = id

    def getTitle(self):
        return self.title

    def setTitle(self, title):
        self.title = title

    def getContent(self):
        return self.content

    def setContent(self, content):
        self.content = content

    def getWords(self):
        return self.words

    def setWords(self, words):
        self.words = words

    def getGmtCreate(self):
        return self.gmtCreate

    def setGmtCreate(self, gmtCreate):
        self.gmtCreate = gmtCreate

    def getGmtModified(self):
        return self.gmtModified

    def setGmtModified(self, gmtModified):
        self.gmtModified = gmtModified

    def getRefUrl(self):
        return self.refUrl

    def setRefUrl(self, refUrl):
        self.refUrl = refUrl

    def getCatalogId(self):
        return self.catalogId

    def setCatalogId(self, catalogId):
        self.catalogId = catalogId

    def getSaveSql(self):
        try:
            saveSql = "INSERT INTO unify_book_capter(book_id, catalog_id, title, content, words, gmt_create, ref_url) " \
                      "VALUES ('%s','%s','%s','%s','%s','%s','%s')" % \
                (self.bookId, self.catalogId, self.title, self.content, self.words, self.gmtCreate, self.refUrl)
            return saveSql
        except BaseException as e:
            print(e)
            return

    def getInfoByTitleSql(self, title):
        querySql = "SELECT id from unify_book_capter where title = '%s'" % title
        return querySql